<?php if(!defined('SIDELOADED')) { echo 'Direct access is not allowed.'; }

if(Session::Get('user') > 0) {
  
  $user = new User(Session::Get('user'));
  
  if($user->Perms('admin')) {
    
    Website::View('page', array(
      'title' => 'Administration',
      'content' => Website::View('admin/index', array(
        'name' => $user->account
      ))
    ), true);
    
  } else {
    
    Website::View('page', array(
      'title' => 'Forbidden',
      'content' => Website::View('error/forbidden')
    ), true);
    
  }
  
} else {
  
  Website::View('page', array(
    'title' => 'Unauthorized',
    'content' => Website::View('error/unauthorized')
  ), true);
  
}
